package cn.educate.service;

import cn.educate.model.SearchResult;
import java.util.List;
import java.util.ArrayList;

public class SearchService {
    public List<SearchResult> search(String query) {
        List<SearchResult> results = new ArrayList<>();

        // 模拟从数据库中搜索结果
        if (query.toLowerCase().contains("example")) {
            results.add(new SearchResult("Example Video", "This is an example video about various topics.", "course-detail.jsp?id=1"));
        }
        if (query.toLowerCase().contains("nature")) {
            results.add(new SearchResult("Nature Education", "Learn about nature and its wonders through this educational video.", "course-detail.jsp?id=2"));
        }
        if (query.toLowerCase().contains("science")) {
            results.add(new SearchResult("Science Exploration", "Discover the world of science and technology with this video.", "course-detail.jsp?id=3"));
        }
        if (query.toLowerCase().contains("culture")) {
            results.add(new SearchResult("Cultural Heritage", "Explore the rich cultural heritage of our villages.", "course-detail.jsp?id=4"));
        }

        // 返回结果列表
        return results;
    }
}
